package com.lushuan.ch04_springboot_logging.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/log")
public class HelloController {

    // 1. 声明日志记录器
    static Logger logger = LoggerFactory.getLogger(HelloController.class);



    @GetMapping
    public String sayHi() {
        logger.trace("跟踪");
        logger.debug("调试");
        logger.info("信息");
        logger.warn("警告");
        logger.error("异常");

        return "hello SpringBoot log";
    }
}
